from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Firefox()
# 最大化浏览器窗口
driver.maximize_window()
url = 'file:///C:/Users/TEACHER/Desktop/NSD2405/html/register.html'
driver.get(url)
# 输入用户名
driver.find_element(By.CSS_SELECTOR, '#user').send_keys('admin')
# 6.刷新
# sleep(3)
# driver.refresh()
# # 点击含有“新浪”的链接
# driver.find_element(By.PARTIAL_LINK_TEXT, '新浪').click()
# # 7.关闭主窗口(第一次打开的窗口)
# sleep(3)
# driver.close()
# 9.获取当前网页的标题
print('标题：', driver.title)
# 10.获取网址
print('网址：', driver.current_url)

sleep(3)
# 8.关闭所有窗口
driver.quit()